<template>
  <div>
      <h1>学生登陆页面</h1>

      <p>账号：<input type="text" v-model="user"></p>
      <p>密码：<input type="text" v-model="pwd"></p>
      <p><button @click="dl">登陆</button></p>
  </div>
</template>

<script>
import axios from 'axios'

export default {
    data(){
        return{
            user:'',
            pwd:'',
        }
    },
    // 点击事件
    methods:{
        dl(){
            axios({
                url:'http://127.0.0.1:8000/zhu/zi2/',
                method:'post',
                data:{"user":this.user,"pwd":this.pwd}
            }).then(res=>{
                console.log(res.data)
                // 跳转
                this.$router.push("/classshow/")
                // 状态保持
                sessionStorage.setItem("user",res.data.user)
                sessionStorage.setItem("pwd",res.data.pwd)
            })
        }
    }
}
</script>

<style>

</style>